import com.chenshu.BeanLifeController;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Created with IntelliJ IDEA
 * Description
 * User：chenshu
 * Date：2023-12-13
 * Time：22:15
 */
public class App {
    public static void main(String[] args) {
        //只有ClassPathXmlApplicationContext会执行PreDestroy方法
        ClassPathXmlApplicationContext context =
                new ClassPathXmlApplicationContext("spring.xml");

        BeanLifeController controller =
                context.getBean("beanLifeController", BeanLifeController.class);
        controller.use();

        context.destroy();
    }
}
